const { sequelize } = require('../../core/db');
const { Sequelize, Model } = require('sequelize');


// 电影
class Book extends Model {

}


Book.init({
    id: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    isbn: {
        type: Sequelize.STRING,
        primaryKey: true,
    },
    title: {
        type: Sequelize.STRING(50),
    },
    original_title: {
        type: Sequelize.STRING(50),
    },
    cover: {
        type: Sequelize.STRING(200),
    },
    author: {
        type: Sequelize.STRING(50),
    },
    binding: {
        type: Sequelize.STRING(20),
    },
    publisher: {
        type: Sequelize.STRING(50),
    },
    price: {
        type: Sequelize.STRING(20),
    },
    pages: {
        type: Sequelize.INTEGER(5),
    },
    publisher_time: {
        type: Sequelize.STRING(11),
    },
    summary: {
        type: Sequelize.TEXT(),
    },
    catalogue: {
        type: Sequelize.TEXT(),
    },
    description: {
        type: Sequelize.STRING(1000),
    },
    status: {
        type: Sequelize.INTEGER(2),
    },
    url: {
        type: Sequelize.STRING(255),
    },
}, {
    sequelize,
    tableName: 'book'
})

module.exports = {
    Book
}